package com.atguigu.jxc.controller;

import com.atguigu.jxc.entity.vo.SupplierGoodsVo;
import com.atguigu.jxc.service.ReturnListGoodsService;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/returnListGoods")
public class ReturnListGoodsController {
    @Autowired
    private ReturnListGoodsService goodsService;

    /**
     * 退货统计（可根据 商品类别、商品编码或名称 条件查询）
     * @param sTime
     * @param eTime
     * @param goodsTypeId
     * @param codeOrName
     * @return
     */
    @PostMapping("/count")
    public String count(String sTime, String eTime ,Integer goodsTypeId, String codeOrName){

        List<SupplierGoodsVo> supplierGoodsVos = goodsService.count(sTime,eTime ,goodsTypeId, codeOrName);

        return new Gson().toJson(supplierGoodsVos);
    }
}
